var isComplete=false;
var mapAction={action:'',argu:[]};
var map=o_mapid;

/*
ui
*/
var Elm=function(obj,defStyle){
	this.init(obj,defStyle);
};
Elm.prototype={
	init:function(obj,defStyle){
		this.obj=obj;
		this.childElms={};
		this.defStyle={};
		if(defStyle){
			this.setDefStyle(defStyle);
		}
	},
	setStyle:function(name,value){
		var style=this.obj.style;
		if(style[name]!=value) style[name]=value;
	},
	getStyle:function(name){
		return this.obj.style[name];
	},
	setDefStyle:function(defStyle){
		if(typeof defStyle=='object'){
			for(var name in defStyle){
				this.defStyle[name]=defStyle[name];
			}
		}
	},
	getDefStyle:function(name){
		return this.defStyle[name];
	},
	reSetStyle:function(names){
		var defStyle=this.defStyle;
		var style=this.obj.style;
		if(!names){
			for(var name in defStyle){
				style[name]=defStyle[name];
			}
		}
		else{
			for(var i=0;i<names.length;i++){
				var name=names[i];
				style[name]=defStyle[name];
			}
		}
	},
	setAttribute:function(name,value){
		this.obj[name]=value;
	},
	getAttribute:function(name){
		return this.obj[name];
	},
	setWidth:function(w){
		this.obj.style.width=w;
	},
	getWidth:function(){
		if(this.obj) return this.obj.offsetWidth;
		return 0;
	},
	setHeight:function(h){
		this.obj.style.height=h;
	},
	getHeight:function(){
		if(this.obj)return this.obj.offsetHeight;
		else return 0;
	},
	hidden:function(){
		if(this.obj.style.display!='none') this.obj.style.display='none';
	},
	show:function(){
		if(this.obj.style.display!='') this.obj.style.display='';
	},
	isHidden:function(){
		var display=this.obj.style.display;
		return display=='none'?true:false;
	},
	addChild:function(name,obj){
		this.childElms[name]=obj;
	},
	getChild:function(name){
		return this.childElms[name];
	},
	hiddenChild:function(names){
		this.hidden();
		var childElms=this.childElms;
		if(!names){
			for(var name in childElms){
				childElms[name].hidden();
			}
		}
		else{
			for(var i=0;i<names.length;i++){
				var name=names[i];
				childElms[name].hidden();
			}
		}
	},
	showChild:function(names){
		this.show();
		var childElms=this.childElms;
		if(!names){
			for(var name in childElms){
				childElms[name].show();
			}
		}
		else{
			for(var i=0;i<names.length;i++){
				var name=names[i];
				childElms[name].show();
			}
		}
	}
};

var ui={
	init:function(){
		this.rightShow=true;
		this.allShow=true;
		this.top=null;
		this.left=null;
		this.right=[];
		this.rightArgs=[];
		this.rightCurrent=0;
		this.args={};
		this.initElms();
		this.initArgs();
		this.isInit=true;
	},
	initElms:function(){
//		var rightPanelBtn=new Elm($('rightPanelBtnDiv'));

//		var rightPanel0=new Elm($('rightPanelDiv'));
//		var rightPanel0Btn=new Elm($('rightPanel0Btn'));
//		var rightPanel0Main=new Elm($('rightPanel0MainDiv'));
//		var rightPanel0Tool=new Elm(null);
//		var rightPanel0TargetCon=new Elm($('rightPanel0TargetConDiv'));
//		var rightPanel0Target=new Elm($('rightPanel0TargetIfr'));
//		rightPanel0.addChild('viewBtn',rightPanelBtn);
//		rightPanel0.addChild('btn',rightPanel0Btn);
//		rightPanel0.addChild('main',rightPanel0Main);
//		rightPanel0.addChild('tool',rightPanel0Tool);
//		rightPanel0.addChild('targetCon',rightPanel0TargetCon);
//		rightPanel0.addChild('target',rightPanel0Target);
//		this.right[0]=rightPanel0;

//		var rightPanel1=new Elm($('rightPanelDiv'));
//		var rightPanel1Btn=new Elm($('rightPanel1Btn'));
//		var rightPanel1Main=new Elm($('rightPanel1MainDiv'));
//		var rightPanel1Tool=new Elm(null);
//		var rightPanel1TargetCon=new Elm($('rightPanel1TargetConDiv'));
//		var rightPanel1Target=new Elm($('rightPanel1TargetIfr'));
//		rightPanel1.addChild('viewBtn',rightPanelBtn);
//		rightPanel1.addChild('btn',rightPanel1Btn);
//		rightPanel1.addChild('main',rightPanel1Main);
//		rightPanel1.addChild('tool',rightPanel1Tool);
//		rightPanel1.addChild('targetCon',rightPanel1TargetCon);
//		rightPanel1.addChild('target',rightPanel1Target);
//		this.right[1]=rightPanel1;

//		var rightPanel2=new Elm($('rightPanelDiv'));
//		var rightPanel2Btn=new Elm($('rightPanel2Btn'));
//		var rightPanel2Main=new Elm($('rightPanel2MainDiv'));
//		var rightPanel2Tool=new Elm($('rightPanel2ToolDiv'));
//		var rightPanel2TargetCon=new Elm($('rightPanel2TargetConDiv'));
//		var rightPanel2Target=new Elm($('rightPanel2TargetIfr'));
//		rightPanel2.addChild('viewBtn',rightPanelBtn);
//		rightPanel2.addChild('btn',rightPanel2Btn);
//		rightPanel2.addChild('main',rightPanel2Main);
//		rightPanel2.addChild('tool',rightPanel2Tool);
//		rightPanel2.addChild('targetCon',rightPanel2TargetCon);
//		rightPanel2.addChild('target',rightPanel2Target);
//		this.right[2]=rightPanel2;

//		var rightPanel3=new Elm($('rightPanelDiv'));
//		var rightPanel3Btn=new Elm($('rightPanel3Btn'));
//		var rightPanel3Main=new Elm($('rightPanel3MainDiv'));
//		var rightPanel3Tool=new Elm($('rightPanel3ToolDiv'));
//		var rightPanel3TargetCon=new Elm($('rightPanel3TargetConDiv'));
//		var rightPanel3Target=new Elm($('rightPanel3TargetIfr'));
//		rightPanel3.addChild('viewBtn',rightPanelBtn);
//		rightPanel3.addChild('btn',rightPanel3Btn);
//		rightPanel3.addChild('main',rightPanel3Main);
//		rightPanel3.addChild('tool',rightPanel3Tool);
//		rightPanel3.addChild('targetCon',rightPanel3TargetCon);
//		rightPanel3.addChild('target',rightPanel3Target);
//		this.right[3]=rightPanel3;

		//this.top=new Elm($('topDiv'));
		//this.left=new Elm($('leftDiv'));
		this.main=new Elm($('mainDiv'));
		this.map=new Elm($('mapDiv'));
		//this.nav=new Elm($('divMapNav'));
	},
	initArgs:function(){
		var domain=o__customValue.domain;
		this.infoDomain='info.'+domain+'.o.cn';
		this.newsDomain='news.'+domain+'.o.cn';


//		this.rightArgs[0]={url:''};
//		this.rightArgs[0].urls={'default':'channel.jspa?locale=!{locale}&city=!{city}&map=!{map}'};
//		this.rightArgs[0].menuId='default';

//		this.rightArgs[1]={url:''};
//		this.rightArgs[1].urls={'default':'http://!{newsDomain}/index.jspa?_flowId=search&locale=!{locale}&host=!{host}&province=!{province}&city=!{city}&map=!{map}'};
//		this.rightArgs[1].menuId='default';

//		this.rightArgs[2]={url:''};
//		this.rightArgs[2].urls={'default':'newmap/yp.jspa?_flowId=indexType&subType=!{id}&yx=0&expand=1&map=!{map}&city=!{city}'};
//		this.rightArgs[2].urls[10000]='newmap/yp.jspa?_flowId=index&yx=0&expand=1&map=!{map}&city=!{city}';
//		this.rightArgs[2].menuId=10000;

//		this.rightArgs[3]={url:'',urls:{}};
//		this.rightArgs[3].urls['default']='';
//		this.rightArgs[3].urls[0]='http://!{infoDomain}/mapIndex.jspa?locale=!{locale}&host=!{host}&province=!{province}&city=!{city}&map=!{map}';
//		this.rightArgs[3].urls[1]='http://!{infoDomain}/house/index.jspa?_flowId=search&locale=!{locale}&host=!{host}&province=!{province}&city=!{city}&map=!{map}';
//		this.rightArgs[3].urls[2]='http://!{infoDomain}/job/index.jspa?_flowId=search&locale=!{locale}&host=!{host}&province=!{province}&city=!{city}&map=!{map}';
//		this.rightArgs[3].urls[3]='http://!{infoDomain}/food/index.jspa?_flowId=search&locale=!{locale}&host=!{host}&province=!{province}&city=!{city}&map=!{map}';
//		this.rightArgs[3].urls[4]='http://!{infoDomain}/love/index.jspa?_flowId=search&locale=!{locale}&host=!{host}&province=!{province}&city=!{city}&map=!{map}';
//		this.rightArgs[3].urls[5]='http://!{infoDomain}/life/index.jspa?_flowId=search&locale=!{locale}&host=!{host}&province=!{province}&city=!{city}&map=!{map}';
//		this.rightArgs[3].urls[6]='http://!{infoDomain}/tour/index.jspa?_flowId=search&locale=!{locale}&host=!{host}&province=!{province}&city=!{city}&map=!{map}';
//		this.rightArgs[3].menuId=0;

		this.args.urls={};
		this.args.urls['index']='channel.jspa?locale=!{locale}&city=!{city}&map=!{map}';
		this.args.urls['mapSearch']='newmap/map.jspa';
		this.args.urls['infoSearch']='http://!{infoDomain}/index.jspa';
		this.args.urls['busline']='newmap/busline.jspa';
		this.args.urls['smart']='newmap/busline.jspa?_flowId=smartSearch&map=!{map}&locale=!{locale}';
		this.args.urls['addNote']='newmap/assistant.jspa?_flowId=edit&map=!{map}&x=!{x}&y=!{y}&locale=!{locale}';
		this.args.urls['showNote']='newmap/assistant.jspa?_flowId=view&id=!{id}';
		this.args.urls['addError']='newmap/mistake.jspa?_flowId=edit&map=!{map}&x=!{x}&y=!{y}&locale=!{locale}';
		this.args.urls['around']='newmap/yp.jspa?_flowId=around&map=!{map}&range=!{range}&x=!{x}&y=!{y}&type=!{type}&locale=!{locale}';
		this.args.urls['infoaround']='newmap/info.jspa?_flowId=around&map=!{map}&range=!{range}&x=!{x}&y=!{y}&type=!{type}&locale=!{locale}';
		this.args.urls['showInfo']='http://!{infoDomain}/!{type}/index.jspa?_flowId=view&type=!{type}&subtype=!{subtype}&id=!{id}&locale=!{locale}';
		this.args.urls['showNews']='http://!{newsDomain}/index.jspa?_flowId=view&uuid=!{id}&locale=!{locale}';
		this.args.urls['unitjoin']='newmap/yp.jspa?_flowId=joinbyentity&entity=!{entity}&entityName=!{entityName}&centerX=!{centerX}&centerY=!{centerY}&map=!{map}&city=!{city}&locale=!{locale}';
		this.args.urls['unitjoin2']='newmap/unitjoin.jspa?map=!{map}&city=!{city}&locale=!{locale}';
		this.args.urls['unitjoin3']='newmap/yp.jspa?_flowId=joinbyunit&unit=!{unit}';
		this.args.urls['arrive']='newmap/busline.jspa';
		this.args.urls['typelist']='http://!{infoDomain}/typelist.jspa?locale=!{locale}&host=!{host}&province=!{province}&city=!{city}&map=!{map}';
		this.args.urls['houseList']='http://!{infoDomain}/house/index.jspa?_flowId=search&locale=!{locale}&host=!{host}&province=!{province}&city=!{city}&map=!{map}';
	},
	getInfoDomain:function(){
		return this.infoDomain;
	},
	getNewsDomain:function(){
		return this.newsDomain
	},
//	showRight:function(view){
//		if(!this.isInit) return;
////		var right=this.right[this.rightCurrent];

////		if(right.isHidden()){
////			right.show();
////			if(this.rightShow) this.left.setStyle('marginRight','373px');
////			else{
////				var w1=right.getChild('viewBtn').getWidth();
////				var w2=right.getChild('tool').getWidth();
////				var w=w1+w2+'px';
////				this.left.setStyle('marginRight',w);
////			}
////		}
//		var flag=0;
//		if(typeof(view)!='undefined') {
//			if(this.rightShow==view) return;
//			else if(view) flag=1;
//			else flag=2;
//		}

//		if(this.rightShow||flag==2){
//			var w1=right.getChild('viewBtn').getWidth();
//			var w2=right.getChild('tool').getWidth();
//			var w=w1+w2+'px';
//			right.setWidth(w);
//			this.left.setStyle('marginRight',w);
//			this.rightShow=false;
//		}
//		else{
//			right.setWidth('373px');
//			this.left.setStyle('marginRight','373px');
//			this.rightShow=true;
//		}
//	},
	fullScreen:function(){
		if(!this.isInit) return;
		var right=this.right[this.rightCurrent];
		if(this.allShow){
			//this.top.hidden();
			//right.hidden();			
			this.main.setStyle('top','0px');			
			//this.left.setStyle('marginRight','0px');
			h=this.bodyHeight;
			this.allShow=false;
		}
		else{
			//this.top.show();
			//right.show();
			this.main.setStyle('top','88px');
//			if(this.rightShow)this.left.setStyle('marginRight','373px');
//			else{
//				var right=this.right[this.rightCurrent];
//				var w1=right.getChild('viewBtn').getWidth();
//				var w2=right.getChild('tool').getWidth();
//				var w=w1+w2+'px';
//				this.left.setStyle('marginRight',w);
//			}
			h=this.bodyHeight-90;
			this.allShow=true;
		}
		this.adjustHeight(h);
	},
//	changePanel:function(i){
//		if(!this.isInit) return;
//		if(!this.rightShow||!this.allShow) this.showRight(true);
//		if(this.rightCurrent==i) return;

//		var right=this.right[this.rightCurrent];
//		right.getChild('main').hidden();
//		right.getChild('btn').setAttribute('className','');
//		right.getChild('target').setAttribute('src','');

//		var right2=this.right[i];
//		right2.getChild('main').show();
//		right2.getChild('btn').setAttribute('className','menu_bg_hit');
//		right2.getChild('target').setAttribute('src',this.getPanelUrl(i));
//		this.rightCurrent=i;
//	},
//	changeTarget:function(panel,id,url){
//		if(!this.isInit) return;
//		if(!this.rightShow||!this.allShow) this.showRight(true);
//		var right=this.right[panel];
//		
//		if(this.rightCurrent!=panel) this.changePanel(panel);
//		else{
//			right.getChild('target').setAttribute('src',this.getPanelUrl(panel,id,url));
//		}
//		if(typeof(id)!='undefined'&&id!=null) this.changeIco(panel,id);
//	},
//	changeIco:function(panel,id){
//		var menuId=this.rightArgs[panel].menuId;
//		var oldIco=$('ico_'+panel+'_'+menuId);
//		var newIco=$('ico_'+panel+'_'+id);
//		this.rightArgs[panel].menuId=id;
//		oldIco.className='';
//		newIco.className='hit';
//	},
//	reloadPanel:function(panel){
//		if(!panel) panel=this.rightCurrent;
//		var url=this.rightArgs[panel].url
//		var right=this.right[panel];
//		this.changeTarget(panel,null,url);
//	},
//	getPanelUrl:function(panel,id,url){
//		var urls=this.rightArgs[panel].urls;
//		var url2='';
//		if(typeof(id)=='undefined') id=this.rightArgs[panel].menuId;
//		if(url){
//			url2=url;
//		}
//		else if(urls[id]){
//			url2=urls[id];
//		}
//		else{
//			url2=urls['default'];
//		}
//		url2=this.processUrl(url2,{id:id});
//		this.rightArgs[panel].url=url2;
//		return url2;
//	},
	getUrl:function(type,params){
		var url=this.args.urls[type];
		if(!url){
			alert('url error');
			return;
		}
		return this.processUrl(url,params);
	},
	processUrl:function(url,params){
		var re=/!{(\w+)}/g;
		params=params||{};
		params['map']=map;
		params['province']=province;
		params['city']=city;
		params['host']=host;
		params['locale']=locale;
		params['infoDomain']=this.infoDomain;
		params['newsDomain']=this.newsDomain;
		return url.replace(re,function(mstr,m1){return params[m1]});
	},
	adjustHeight:function(h){
		var right=this.right[this.rightCurrent];
		this.setMapHeight(h+'px');
		this.main.setHeight(h+'px');
		this.map.setHeight(h+'px');
		//this.left.setHeight(h+'px');
		//right.setHeight(h+'px');
//		if(!this.nav.isHidden())this.nav.setHeight(h+'px');
//		var rights=this.right;
//		for(var i=0;i<rights.length;i++){
//			rights[i].getChild('targetCon').setHeight(h-20+'px');
//			rights[i].getChild('target').setHeight(h-20+'px');
//		}
//		this.adjustTool(h);
	},
//	adjustTool:function(h){
//		if(h>649){
//			$('rightPanel2ToolMainDiv').style.height=h+'px';
//			$('rightPanel2ToolBodyDiv').style.top='0px';
//			$('rightPanel2ToolBtnDiv').style.display='none';
//		}
//		else{
//			$('rightPanel2ToolMainDiv').style.height=h-85+'px';
//			$('rightPanel2ToolBtnDiv').style.display='';
//		}
//		if(h>413){
//			$('rightPanel3ToolMainDiv').style.height=h+'px';
//			$('rightPanel3ToolBodyDiv').style.top='0px';
//			$('rightPanel3ToolBtnDiv').style.display='none';
//		}
//		else{
//			$('rightPanel3ToolMainDiv').style.height=h-85+'px';
//			$('rightPanel3ToolBtnDiv').style.display='';
//		}
//	},
//	ajustNav:function(){
//		var w=navUtils.getWidth();
//		var h=navUtils.getHeight();
//		var mapW=this.map.getWidth();
//		var mapH=this.map.getHeight();
//		$('divMapNavContent').style.left=Math.floor((mapW-w)/2)+'px';
//		$('divMapNavContent').style.top=Math.floor((mapH-h)/2)+'px';
//	},
//	shiftTool:function(panel,state){
//		var objMain=$('rightPanel'+panel+'ToolMainDiv');
//		var objBody=$('rightPanel'+panel+'ToolBodyDiv');
//		var sh=objBody.offsetHeight-objMain.offsetHeight;
//		var top=objBody.offsetTop;
//		if(state==0){
//			if(top+sh>0){
//				objBody.style.top=top-60+'px';
//			}
//		}
//		else{
//			if(top<0){
//				objBody.style.top=top+60+'px';
//			}
//		}
//	},
	setMapHeight:function(h){
		try{
			popomap.setHeight(h);
		}
		catch(e){}
	},
	resize:function(){
		this.bodyWidth=document.documentElement.clientWidth;
		this.bodyHeight=document.documentElement.clientHeight;
		//var right=this.right[this.rightCurrent];
		$('cityDiv').style.display='none';
		if(this.bodyWidth<998){
			//this.top.setWidth('998px');
			this.main.setWidth('998px');
		}
		else{
			//this.top.setWidth('100%');
			this.main.setWidth('100%');
		}
		var h=this.main.getHeight();
		if(this.allShow){
			h=this.bodyHeight-90;
		}
		else{
			h=this.bodyHeight;
		}
		this.adjustHeight(h);
		//this.ajustNav();
	}
};
//var navUtils={
//	init:function(data){
//		this.navData=data;
//		this.navView=true;
//		this.navDataMap={};
//		this.currentNav={width:671,height:549};
//		for(var i=0;i<data.length;i++){
//			this.navDataMap[data[i].id]=i;
//		}
//	},
//	getWidth:function(){
//		return this.currentNav.width;
//	},
//	getHeight:function(){
//		return this.currentNav.height;
//	},
//	getHtml:function(id){
//		var pos=0;
//		if(id)pos=this.navDataMap[id];
//		var nav=this.navData[pos];
//		if(!nav) return '';

//		this.currentNav.id=id;

//		var htmlStr='';
//		htmlStr+=this.getImageHtml(nav);
//		htmlStr+=this.getMapHtml(nav);

//		return htmlStr;
//	},
//	getImageHtml:function(nav){
//		var width=671;
//		var height=549;
//		if(nav.width) width=nav.width;
//		if(nav.height) height=nav.height;

//		this.currentNav.width=width;
//		this.currentNav.height=height;

//		var src=nav.image;
//		var htmlStr='<img src="http://image.o.cn'+src+'" border="0" width="'+width+'" height="'+height+'" usemap="#Map" />';
//		if(this.getFileExt(src)=='png'){
//			//html='';
//		}
//		else{
//		}
//		return htmlStr;
//	},
//	getMapHtml:function(nav){
//		var anchorArr=nav.anchors;
//		var htmlStr='<map id="Map" name="Map">\n';
//		for(var i=0;i<anchorArr.length;i++){
//			var anchor=anchorArr[i];
//			htmlStr+='<area shape="poly" coords="'+anchor.coords+'" href="#" onclick="enterByNav('+anchor.params+',1)" title="'+anchor.name+'" />\n';
//		}
//		htmlStr+='</map>\n'+o_nav;
//		return htmlStr;
//	},
//	getNavListHtml:function(){
//		var div=$('navpop1a');
//		var navData=this.navData;
//		var htmlStr='';
//		for(var i=0;i<navData.length;i++){
//			htmlStr+='<a href="#" onclick="navUtils.loadNav('+navData[i].id+')">'+navData[i].name+'</a>';
//		}
//		return htmlStr;
//	},
//	loadNav:function(id){
//		var htmlStr=this.getHtml(id);
//		$('divMapNavContent').innerHTML=htmlStr;
//		this.switchNavView(true);
//	},
//	switchNavView:function(flag){
//		if(typeof(flag)=='undefined'){
//			if($('divMapNav').style.display=='none'){
//				$('divMapNav').style.display='';
//				this.navView=true;
//				if(!this.navTimer)this.navTimer=setInterval(this.openNav.bind(this),10);
//			}
//			else{
//				this.navView=false;
//				if(!this.navTimer)this.navTimer=setInterval(this.closeNav.bind(this),10);
//			}
//		}
//		else{
//			if(flag){
//				if($('divMapNav').style.display=='') return;
//				this.navView=true;
//				$('divMapNav').style.display='';
//				if(!this.navTimer)this.navTimer=setInterval(this.openNav.bind(this),10);
//			}
//			else{
//				if($('divMapNav').style.display=='none') return;
//				this.navView=false;
//				if(!this.navTimer)this.navTimer=setInterval(this.closeNav.bind(this),10);
//			}
//		}
//		this.down1();
//	},
//	openNav:function(){
//		var divMapHeight=$('mapDiv').offsetHeight;//
//		var h=$('divMapNav').offsetHeight;
//		var step=45;
//		if(h<divMapHeight){
//			if(h+step<=divMapHeight)$('divMapNav').style.height=h+step+'px';
//			else $('divMapNav').style.height=divMapHeight+'px';
//		}
//		else{
//			clearInterval(this.navTimer);
//			this.navTimer=null;
//		}
//	},
//	closeNav:function(){
//		var h=$('divMapNav').offsetHeight;
//		var step=45;
//		if(h>step){
//			$('divMapNav').style.height=h-step+'px';
//		}
//		else{switchObjView('loading',false);
//			$('divMapNav').style.display='none';
//			clearInterval(this.navTimer);
//			this.navTimer=null;
//		}
//	},
//	switchNavListView:function(flag){
//		var navListDiv=$('navpop1a');
//		if(typeof(flag)=='undefined'){
//			if(navListDiv.style.display=='none'){
//				this.navListView=true;
//				navListDiv.style.display='';
//			}
//			else{
//				this.navListView=false;
//				navListDiv.style.display='none';
//			}
//		}
//		else{
//			if(flag){
//				this.navListView=true;
//				navListDiv.style.display='';
//			}
//			else{
//				this.navListView=false;
//				navListDiv.style.display='none';
//			}
//		}
//		this.down1();
//		this.down2();
//	},
//	writeNav:function(){
//		var htmlStr=this.getHtml();
//		if(useNav&&htmlStr)document.write(htmlStr);
//		else{
//			$('divMapNav').style.display='none';
//			$('nav1Div').style.display='none';
//		}
//	},
//	down1:function(){
//		if(this.navView){
//			utils.html.swapImages(null,'nav1Img','images/skin3/index/nav/navbg1a_sel.gif');
//		}
//		else{
//			utils.html.swapImages(null,'nav1Img','images/skin3/index/nav/navbg1a_hover.gif');
//		}
//	},
//	down2:function(){
//		if(this.navListView){
//			utils.html.swapImages(null,'nav2Img','images/skin3/index/nav/navbg1b_sel.gif');
//		}
//		else{
//			utils.html.swapImages(null,'nav2Img','images/skin3/index/nav/navbg1b_hover.gif');
//		}
//	},
//	over:function(){
//		var nav=$('divMapNav');
//		var navList=$('navpop1a');
//		if(this.navView||this.navListView) return;
//		utils.html.swapImages(null,'nav1Img','images/skin3/index/nav/navbg1a_hover.gif','nav2Img','images/skin3/index/nav/navbg1b_hover.gif');
//	},
//	out:function(){
//		var nav=$('divMapNav');
//		var navList=$('navpop1a');
//		if(this.navView||this.navListView) return;
//		utils.html.swapImages(null,'nav1Img','images/skin3/index/nav/navbg1a.gif','nav2Img','images/skin3/index/nav/navbg1b.gif');
//	},
//	getFileExt:function(file){
//		var index=file.lastIndexOf('.');
//		var ext=file.substring(index+1,file.length);
//		return ext.toLowerCase();
//	}
//}
function body_onload(){
	ui.init();
	ui.resize();
	doMapAction();
	//ifrRight=rightPanel0TargetIfr;//for old
	//setTimeout('loadend()',2000);
	loadend();
	document.body.onmouseup=function(){hiddenCityDiv();};
	$('cityDiv').onmouseup=function(evt){evt.cancelBubble=true;return false}.bindAsEventListener(this);
}
function doc_resize(){
	ui.resize();
}
function hiddenCityDiv(){
	var obj=$('cityDiv');
	if(obj.style.display=='none') return;
	obj.style.display='none';
}
window.onresize=doc_resize;

function textEvent(obj,type){
	switch(type){
		case 'focus':
			obj.isfocus=true;
			utils.html.cleanText(obj,1);
		case 'mouseover':
			utils.html.changeStyle(obj,'borderColor','#91cf0f');
			break;
		case 'blur':
			obj.isfocus=false;
			utils.html.cleanText(obj,0);
		case 'mouseout':
			if(!obj.isfocus) utils.html.changeStyle(obj,'borderColor','#b4b4b4');
			break;
	}
}

/*for old*/
function showRight(flag){
	ui.showRight(flag);
}
function fullScreen(){
	ui.fullScreen();
}
function changePanel(panel){
	ui.changePanel(panel);
}
function changeIfr_info(id,url){
	if(url&&url!='undefined'){
		if(url&&url.indexOf('http')==-1){
			url='http://'+ui.getInfoDomain()+url;
		}
	}
	else{
		url='';
	}
	ui.changeTarget(3,id,url);
}
/*old*/
function doMapAction(){
	if(typeof(popomap)&&popomap.getMapStatus()){
		switch(mapAction.action){
			case 'showResult':
				showResult(mapAction.argu[0],mapAction.argu[1]);
				break;
			case 'showNote':
				showNote(mapAction.argu[0]);
				break;
			case 'doRight':
				popomap.init(0,0,true);
				doRight(mapAction.argu);
				break;
			default:
				loadXY();
				break;
		}
		//if(mapAction.action!='doRight')doRight(1);
	}
	else{
		setTimeout('doMapAction()',500);
	}
}
function doRight(argu){
	var right=argu[0];
	var unit=argu[1];
	var param1=argu[2];
	var params='city='+city+'&province='+province+'&map='+map+'&host='+host;
	switch(right){
		case '1':
			rightOpen(ui.getUrl('index'));
			break;
		case '2':
			rightOpen(ui.getUrl('houseList'),3,1);
			break;
		case '3':
			rightOpen(ui.getUrl('typelist'));
			break;
		case '4':
			var url=ui.getUrl('unitjoin3',{unit:unit});
			rightOpen(url);
			break;
		case '5':
			var url=decodeURIComponent(param1+'&locale='+o_locale+'&'+params);
			rightOpen(url);
			break;
		case 'tour':
			var url='gztour.htm?pos='+param1;
			rightOpen(url,3,6);
			break;
		default:
			//rightOpen(ui.getUrl('index'));
			break;
	}
}
function rightOpen(url,panel,type){
	if(typeof(panel)!='number') panel=0;
	if(typeof(type)!='number') type=null;
	ui.changePanel(panel);
	ui.changeTarget(panel,type,url);
}
function loadend(){
	isComplete=true;
	switchObjView('loading',false);
}
function isBodyLoaded(){
	return isComplete;
}
var maptype=3;
function changeMapType(id){
	maptype=id;
	popomap.changeMapType(id);
}
var isloadSign={};
isloadSign['1']=false;
isloadSign['2']=false;
function loadSign(id){
	if(isloadSign[id]) isloadSign[id]=false;
	else isloadSign[id]=true;
	var value=isloadSign[id];
	switch(id){
		case 1:
			break;
		case 2:
			if(value) popomap.loadSign('BusStation');
			else popomap.removeSign('BusStation');
			break;
		case 3:
			break;
		default:
			break;
	}
}
function switchObjView(id,flag){
	if(!$(id))return false;
	if(flag=='undefined'){
		with($(id).style){
			display=display==''?'none':'';
		}
	}
	else{
		if(flag){
			$(id).style.display='';
		}
		else{
			$(id).style.display='none';
		}
	}
}
function switchMapView(flag){return;
	if(flag=='undefined'){
		with($('mapDiv').style){
			display=display==''?'none':'';
		}
	}
	else{
		if(flag){
			$('mapDiv').style.display='';
		}
		else{
			$('mapDiv').style.display='none';
		}
	}
}
function switchCity(){
	var obj=$('cityDiv');
	if(obj.style.display==''){
		obj.style.display='none';
	}
	else{
		obj.style.display='';
		//obj.style.left=bodyWidth-300;
	}
}
function enterByNav(id,type){
	if(!isBodyLoaded()) return false;
	showResult(id,type);
}
function getNavStatus(){
	if($('divMapNav').style.display=='')
		return true;
	else 
		return false;
}
function switchNavView(flag){
	if(typeof(flag)=='undefined'){
		navUtils.switchNavView();
	}
	else{
		navUtils.switchNavView(flag);
		navUtils.out();
	}
}
function switchNavView2(){
	if(!isBodyLoaded()) return false;
	switchNavView();
}
function writeLocaleSwitch(){
	var str1='<a href="http://'+host+'/index.jspa?locale=zh_cn">'+national.getStr('Common','GB','简')+'</a>/<a href="http://'+host+'/index.jspa?locale=zh_tw">'+national.getStr('Common','BIG5','繁')+'</a>';
	var str2='/<a href="http://en.'+domain+'.o.cn/index.jspa">English</a>';
	document.write(str1);
	if(domain=='yiwu'){
		document.write(str2);
	}
}
function showBBS(){
	switch (domain){
		case 'macau':
	  	window.open('http://bbs.yeahmacau.com');
		break;
	  case 'gy':
	  	window.open('http://www.vcovc.com/bbs');
		break;
	  default:
	  	window.open('http://bbs.o.cn');
		break;
	}
}
function postInfo () {
    changePanel(0);
    ui.changeTarget(0,null,ui.getUrl('typelist'));
}



function isEmpty(fieldValue)
{
	var regEx = /\S+/i;
	if(regEx.test(fieldValue))
		return false;
	else
		return true;
}
function setMapValue(form){
	var flag=true;
	if(form&&form.locale){
		if(typeof(o_locale)=='string')form.locale.value=o_locale;
	}
	if(form&&form.map){
		if(typeof(map)=='number'){
			form.map.value=map;
		}
		else{
			national.showMsg('%{NoMap:没有找到地图}');
			flag=false;
		}
	}
	if(flag)switchNavView(false);
	return flag;
}
function dosearch(form,keyword,initKey)
{
	if(!keyword&&(isEmpty(form.keyword.value)||form.keyword.value==initKey)){
	  national.showMsg('%{EnterKeyword:请输入关键字}');
	  form.keyword.focus();
	  return false;
	}
	if(!setMapValue(form)) return false;
	ui.changePanel(0);
	//setPanel2Style();
	if(keyword){
		form.keyword.value=keyword;
		form.submit();
	}
	return true;
}
function dosearch1(keyword){
	if(!isComplete) {
		national.showMsg('%{WaitMap:请在加载完以后再搜索,谢谢}!');
		return false;
	}
	var form=document.mapForm;
	form.action = ui.getUrl('mapSearch');
	form.target = 'rightPanel0TargetIfr';
	if(form.screen){
		var d=getMapRang();
		form.lx.value=Math.floor(d.startX/2);
		form.ly.value=Math.floor(d.startY/2);
		form.ux.value=Math.floor(d.endX/2);
		form.uy.value=Math.floor(d.endY/2);
	}
	var initKey=national.getStr('Common','MapSearchValue','楼房实体 / 道路 / 河流');
	return dosearch(form,keyword,initKey);
}
function dosearch2(keyword){
	if(!isComplete) {
		national.showMsg('%{WaitMap:请在加载完以后再搜索,谢谢}!');
		return false;
	}
	var form=document.ypForm;
	form.action = 'newmap/yp.jspa';
	form.target = 'ifrRight';
	var initKey='医疗保健 / 维修中心 / 企业服务 / 美容健身 / 运动休闲...';
	return dosearch(form,keyword,initKey);
}
function dosearch3(keyword){
	if(!isComplete) {
		national.showMsg('%{WaitMap:请在加载完以后再搜索,谢谢}!');
		return false;
	}
	var form=document.infoForm;
	form.map.value=map;
	form.host.value=host;
	form.action = ui.getUrl('infoSearch');
	form.target = 'rightPanel0TargetIfr';
	var initKey=national.getStr('Common','InfoSearchValue','房产 / 工作 / 美食 / 购物 / 旅游 / 交友 / 本地新闻...');
	return dosearch(form,keyword,initKey);
}
function doquerySmart(){
	rightOpen(ui.getUrl('smart'));
}
function doquery1(form)
{
	if(!isComplete) {
		national.showMsg('%{WaitMap:请在加载完以后再搜索,谢谢}!');
		return false;
	}
    if (isEmpty(form.from.value)||form.from.value=='所在地')
	{
   	   national.showMsg('%{EmptyFrom:起始不能为空}');
	   form.from.focus();
      return false;
     }
	 else if (isEmpty(form.to.value )||form.to.value=='目的地')
	 {
   	   national.showMsg('%{EmptyTo:终点不能为空}');
	   form.to.focus();
       return false;
     }else
	 {
	    form.action = ui.getUrl('busline');
		form.target = 'rightPanel0TargetIfr';
		//ui.changePanel(0);
		//setPanel2Style();
		//menuSwitch('search');
	 }
	 return setMapValue(form);
 } 
function doquery2(form)
{  
	if(!isComplete) {
		national.showMsg('%{WaitMap:请在加载完以后再搜索,谢谢}!');
		return false;
	}
     if (isEmpty(form.stationName.value )||form.stationName.value==national.getStr('Common','StationSearchValue','例如:体育中心'))
	{
   	   national.showMsg('%{EmptyStation:站点不能为空}');
	   form.stationName.focus();
       return false;
     }else
	 {
	    form.action = ui.getUrl('busline');
		form.target = 'rightPanel0TargetIfr';
		//ui.changePanel(0);
		//setPanel2Style();
		//menuSwitch('search');
	 }
	 return setMapValue(form);
 }
function doquery3(form)
{
	if(!isComplete) {
		national.showMsg('%{WaitMap:请在加载完以后再搜索,谢谢}!');
		return false;
	}
     if (isEmpty(form.name.value )||form.name.value==national.getStr('Common','LineSearchValue','例如:178'))
	 {
   	   national.showMsg('%{EmptyLine:路线不能为空}');
	   form.name.focus();
      return false;
     }else
	 {
	    form.action = ui.getUrl('busline');
		form.target = 'rightPanel0TargetIfr';
		//ui.changePanel(0);
		//setPanel2Style();
		//menuSwitch('search');
	 }
	 return setMapValue(form);
 }


 function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }

  return elements;
}